<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
    /* 将string--number
        parseInt()
        parseFloat()
        Number()
     */
    var str="12.2222px";
    console.log(Number(str));//局限性：智能识别纯数字的字符串
    console.log(parseInt(str));//1.开头的字符必须以数字开头 2.遇到非数字的字符就停止解析
    console.log(parseFloat(str));
    </script>
</body>
</html>